package com.marvels.approve.process.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.marvels.approve.process.dto.RoomLogDTO;
import com.marvels.approve.process.service.IFaceSigService;
import com.marvels.common.dto.MarvelsResultDTO;
import com.marvels.common.exception.MarvelsBusinessException;
import com.marvels.common.exception.MarvelsErrorCode;
import com.marvels.common.utils.MarvelsLogUtil;

@RestController
@RequestMapping("/approve/roomlog/service")
public class RoomLogController {
	@Autowired
	private IFaceSigService iFaceSigService;

	/**
	 * 房间日志记录
	 * 
	 * @return
	 */
	@RequestMapping("/getRoomLog/{appointmentId}")
	@ResponseBody
	public MarvelsResultDTO getRoomLog(@PathVariable("appointmentId") Integer appointmentId) {
		List<RoomLogDTO> list = null;
		try {
			list = iFaceSigService.selectRoomLogList(appointmentId);
		} catch (MarvelsBusinessException e) {
			return MarvelsResultDTO.getResult(MarvelsErrorCode.FAIL.getValue(), e.getMessage(), e.getMessage());
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("[getRoomLog] list = " + list.toString(), e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.ERROR.getValue(), MarvelsErrorCode.ERROR.getDesc(), e);
		}
		return MarvelsResultDTO.getResult(MarvelsErrorCode.SUCCESS.getValue(), MarvelsErrorCode.SUCCESS.getDesc(),list);
	}
}
